package com.ydd.adapter;

import android.content.Context;
import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.ydd.R;
import com.ydd.model.story.StoryCommentValue;
import com.ydd.util.glide.GlideManager;

import java.util.List;

/**
 * Created by tao on 17-3-23.
 */

public class StoryCommentAdapter extends BaseQuickAdapter<StoryCommentValue> {
    private Context mContext;

    public StoryCommentAdapter(Context context, List<StoryCommentValue> data) {
        super(R.layout.item_comment_layout, data);
        this.mContext = context;
    }

    @Override
    protected void convert(BaseViewHolder holder, StoryCommentValue value) {
        GlideManager.loadImageView(mContext,value.logo, (ImageView) holder.getView(R.id.photo_view));
        holder.setText(R.id.name_view,value.name);
        holder.setText(R.id.text_view,value.text);

        holder.setOnClickListener(R.id.comment_layout,new OnItemChildClickListener());
    }
    public void addComment(StoryCommentValue value) {
        mData.add(0, value);
        notifyDataSetChanged();
    }
}
